package com.pxst.internalReports.controller;

import com.pxst.bank.entity.SysBankReceiveRecordEntity;
import com.pxst.internalReports.req.BankAccountListReq;
import com.pxst.bank.service.SysAvailableBankService;
import com.pxst.internalReports.resp.AccountListResp;
import com.pxst.internalReports.resp.BankAccountListResp;
import com.pxst.resp.ApiResp;
import com.pxst.resp.PageResp;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;


/**
 * @author Txd
 * @since 2023-09-13 11:23:10
 */
@Api(tags = "银行账户监控相关接口")
@RestController
@RequestMapping("/bankAccount")
@Validated
public class BankAccountController {

    @Autowired
    private SysAvailableBankService sysAvailableBankService;

    /**
     * 银行账户监控列表查询接口
     * @param bankAccountListReq
     * @return ApiResp<PageResp<BankAccountListResp>>
     */
    @ApiOperation(value = "银行账户监控列表查询接口")
    @GetMapping("/bankAccountList")
    public ApiResp<PageResp<BankAccountListResp>> getBankAccountList(BankAccountListReq bankAccountListReq) {
        return sysAvailableBankService.getBankAccountList(bankAccountListReq);
    }

    /**
     * 银行账户监控列表中账户代码in change功能接口
     * @param id
     * @return ApiResp<SysBankReceiveRecordEntity>
     */
    @ApiOperation(value = "银行账户监控列表中账户代码in change功能接口")
    @PutMapping("/take")
    public ApiResp<SysBankReceiveRecordEntity> take(@RequestParam @ApiParam("系统银行卡ID") Long id) {
        return sysAvailableBankService.take(id);
    }

    /**
     * 银行账户监控列表中账户代码归还功能接口
     * @param id
     * @return ApiResp<SysBankReceiveRecordEntity>
     */
    @ApiOperation(value = "银行账户监控列表中账户代码归还功能接口")
    @PutMapping("/return")
    public ApiResp<SysBankReceiveRecordEntity> returnCard(@RequestParam @ApiParam(value = "系统银行卡ID", required = true) Long id) {
        return sysAvailableBankService.returnCard(id);
    }

    /**
     * 银行账户监控强制归还功能接口
     * @param id
     * @return ApiResp<String>
     */
    @ApiOperation(value = "银行账户监控强制归还功能接口")
    @PutMapping("/forceReturnCards")
    public ApiResp<String> forceReturnCards(@RequestParam @ApiParam(value = "用户ID", required = true) Long id) {
        return sysAvailableBankService.forceReturnCards(id);
    }

    /**
     * 账户列表查询接口
     * @param type
     * @return ApiResp<List<Map<String,List<AccountListResp>>>>
     */
    @ApiOperation(value = "账户列表查询接口")
    @GetMapping("/accountList")
    public ApiResp<List<Map<String, List<AccountListResp>>>> getAccountList(@RequestParam @ApiParam(value = "账户类型", required = true) Integer type) {
        return sysAvailableBankService.getAccountList(type);
    }

}
